﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/Master/FrameMain.Master"
    AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Jzy.Web.Desktop.Default" %>

<%@ Register src="Mail.ascx" tagname="Mail" tagprefix="uc1" %>

<%@ Register src="Notice.ascx" tagname="Notice" tagprefix="uc2" %>

<%@ Register src="Workflow.ascx" tagname="Workflow" tagprefix="uc3" %>

<%@ Register src="Calendar.ascx" tagname="Calendar" tagprefix="uc4" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../Common/Js/JQuery/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../Common/Js/JQuery/jquery.ui.core.js" type="text/javascript"></script>
    <script src="../Common/Js/JQuery/jquery.ui.widget.js" type="text/javascript"></script>
    <script src="../Common/Js/JQuery/jquery.ui.mouse.js" type="text/javascript"></script>
    <script src="../Common/Js/JQuery/query.ui.sortable.js" type="text/javascript"></script>
    <script type="text/javascript">
        var modules = "";//用户桌面模块及排序
        $(function ()
        {
            $(".column").sortable({
                connectWith: ".column",
                handle: ".portlet_header",
                helper: "original",
                revert: true,

                update: function (event, ui)
                {
                    var ids = "{";
                    $(".column").each(function (index)
                    {
                        if (index != 0)
                        {
                            ids += ",";
                        }
                        ids += $(this).attr("id") + ":[";


                        $(this).children().each(function (index)
                        {
                            if (index != 0)
                            {
                                ids += ",";
                            }
                            ids += "'" + $(this).attr("id") + "'";
                        });

                        ids += "]";
                    });

                    ids += "}";

                    if (modules != ids) //由于每次更新此事件会被执行两次，所以在此加判断
                    {
                        modules = ids;                       
                        //保存
                        $.post("save.ashx", { "modules": modules }, function ()
                        { 
                            //保存后的回调函数
                        });
                        eval("obj = " + modules);

                        //alert(obj.column2.length);
                    }


                }
            });
            $(".column").disableSelection();
        });

    </script>

    <style type="text/css">
        #container 
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="column1" style="width: 50%; float: left; " class="column">
       <uc1:Mail ID="Mail1" runat="server" />
       <uc4:Calendar ID="Calendar1" runat="server" /><!----> 
    </div>
    <div id="column2" style="float:left; width:50%; " class="column">       
        <uc2:Notice ID="Notice1" runat="server" />   
        <uc3:Workflow ID="Workflow1" runat="server" />     <!--  --> 
    </div>

    <div id="container"></div>
    
</asp:Content>
